package edu.nf.ch05.service;

import edu.nf.ch05.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

/**
 * @author wangl
 * @date 2025/4/28
 */
//@Component("userService")
//从3.0开始使用@Service注解标识业务层
@Service("userService")
public class UserServiceImpl implements UserService {


    private UserMapper userMapper;

    /**
     * 方式二：当有多个实现类可以结合@Qualifier
     * 注解来注入需要的bean
     */
    public UserServiceImpl(@Qualifier("studentMapper") UserMapper userMapper) {
        this.userMapper = userMapper;
    }


    @Override
    public void save() {
        userMapper.add();
    }
}